/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package api.gest;

import api.dom.Camion;
import java.util.ArrayList;

/**
 *
 * @author Enrico
 */
public class GestCamiones {
    private ArrayList<Camion> mColCamiones = new ArrayList<Camion>();
    private static GestCamiones objGestC = null;
    
      public static GestCamiones getInstance()
  {
        if (objGestC == null){
            objGestC = new GestCamiones();
            }
        return objGestC;
  }
      
      public boolean verificarCamion(Camion xObjC){
          for(Camion c: mColCamiones){
              if(c.getcMatricula()==xObjC.getcMatricula()){
                 return true;
              }                 
          }
          return false;
      }
      
      public boolean altaCamiones(Camion xObjC){
          if(!verificarCamion(xObjC)){
              mColCamiones.add(xObjC);
              return true;
          }
          return false;
      }
      
      public boolean bajaCamiones(Camion xObjC){
          mColCamiones.remove(xObjC);
          return true;
      }
      
      public ArrayList<Camion> devolverCamiones(){
          return mColCamiones;
      }
      
      public boolean modificarCamiones(Camion xObjC){
          mColCamiones.set(mColCamiones.indexOf(xObjC), xObjC);
          return true;
      }
      
      
      
      
   
}
